<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>CruiseControl.NET : Subversion Source Control Block</title>
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
    </head>

    <body>
	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
		    <tr>
			    <td valign="top" class="pagebody">
				    <div class="pageheader">
					    <span class="pagetitle">
                            CruiseControl.NET : Subversion Source Control Block
                                                    </span>
				    </div>
				    <div class="pagesubheading">
					    This page last changed on Mar 24, 2009 by <font color="#0050B2">williams</font>.
				    </div>

				    <p>CruiseControl.NET provides basic support for Subversion repositories. Checking for changes, checking out or updating sources, and tagging-by-copying are supported, but more advanced features such as using Subversion revision numbers are not yet supported. Subversion support is under active development and will improve over time.</p>

<p>To configure the CruiseControl.NET server to monitor a Subversion repository, edit ccnet.config and configure sourcecontrol to point at your repository.</p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>SVN Checkout</b><br />As of the CCNet 1.2 release, the SVN provider now supports automatic checkout of source.  If the working directory does not contain a <tt>.svn</tt> folder (or <tt>&#95;svn</tt> folder), the SVN block will automatically perform a checkout instead of an update.  The <tt>trunkUrl</tt> must be specified for checkout to function.</td></tr></table></div>
<p><div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>

<p>&nbsp;cleanUp and revert are available after the 1.4.3 release, so for the moment only in nightly builds.</p>

</td></tr></table></div><br clear="all" /></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;sourcecontrol type=<span class="code-quote">"svn"</span>&gt;</span>
	<span class="code-tag">&lt;trunkUrl&gt;</span>svn://svn.mycompany.com/myfirstproject/trunk<span class="code-tag">&lt;/trunkUrl&gt;</span>
	<span class="code-tag">&lt;workingDirectory&gt;</span>c:\dev\ccnet<span class="code-tag">&lt;/workingDirectory&gt;</span>
<span class="code-tag">&lt;/sourcecontrol&gt;</span></pre>
</div></div>
<p>The <b>&lt;trunkUrl&gt;</b> tag should specify the URL to use to determine if changes have occurred in your repository.</p>

<p>You need to make sure your SVN client settings are such that all authentication is automated. Typically you can do this by using anonymous access or appropriate SSH setups if using SVN over SSH.</p>

<h3><a name="SubversionSourceControlBlock-ConfigurationElements%3A"></a>Configuration Elements:</h3>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Node </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Required </th>
</tr>
<tr>
<td class='confluenceTd'> trunkUrl </td>
<td class='confluenceTd'> The url for your repository (<em>e.g.</em>, svn://svnserver/) </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> N/A </td>
<td class='confluenceTd'> Only if autoGetSource=true </td>
</tr>
<tr>
<td class='confluenceTd'> workingDirectory </td>
<td class='confluenceTd'> The directory containing the locally checked out workspace. </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> The project working directory </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> executable </td>
<td class='confluenceTd'> The location of the svn executable </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> "svn.exe" </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> username </td>
<td class='confluenceTd'> The username to use for authentication when connecting to the repository. </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> N/A </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> password </td>
<td class='confluenceTd'> The password to use for authentication when connecting to the repository. </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> N/A </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> <a name="SubversionSourceControlBlock-autoGetSource"></a> autoGetSource </td>
<td class='confluenceTd'> Whether to retrieve the updates from Subversion for a particular build. </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> true </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> checkExternals </td>
<td class='confluenceTd'> Whether to check the paths specified in the svn:externals property for modifications. </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> checkExternalsRecursive </td>
<td class='confluenceTd'> Whether to check for modifications of svn:externals recursively. </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> true </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> cleanCopy </td>
<td class='confluenceTd'> Whether to delete the working copy before updating the source. </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> webUrlBuilder </td>
<td class='confluenceTd'> The root url for the WebSVN site </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> N/A </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> tagOnSuccess </td>
<td class='confluenceTd'> Indicates that the repository should be tagged if the build succeeds. </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> tagBaseUrl </td>
<td class='confluenceTd'> The base url for tags in your repository. </td>
<td class='confluenceTd'> string </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> timeout </td>
<td class='confluenceTd'> Sets the timeout period for the source control operation. See <a href="Timeout Configuration.html" title="Timeout Configuration">Timeout Configuration</a> for details. </td>
<td class='confluenceTd'> Timeout </td>
<td class='confluenceTd'> 10 minutes </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> revert<br clear="all" /> </td>
<td class='confluenceTd'> Reverts any local changes to a file or directory and            resolves any conflicted states. <b>svn             revert</b> will not only revert the contents of an             item in your working copy, but also any property             changes.  Finally, you can use it to undo any scheduling             operations that you may have done (e.g. files scheduled             for addition or deletion can be             "unscheduled"). </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> false <br clear="all" /> </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> cleanUp </td>
<td class='confluenceTd'> Recursively clean up the working copy, removing            locks resuming unfinished operations.  If you ever get a             "working copy locked" error, run this             command to remove stale locks and get your working copy             into a usable state again </td>
<td class='confluenceTd'> bool </td>
<td class='confluenceTd'> false<br clear="all" /> </td>
<td class='confluenceTd'> false<br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> issueUrlBuilder </td>
<td class='confluenceTd'> Converts the comment (or parts from it) into an url pointing to the issue for this build. <br clear="all" />
See <a href="IssueUrlBuilder.html" title="IssueUrlBuilder">Issue Builder</a> for more details <br clear="all" /> </td>
<td class='confluenceTd'> Group </td>
<td class='confluenceTd'> N/A </td>
<td class='confluenceTd'> false <br clear="all" /> </td>
</tr>
</tbody></table>

<h3><a name="SubversionSourceControlBlock-LinkingmodificationstoWebSVN"></a>Linking modifications to WebSVN</h3>

<p>You can link the modifications detected by CruiseControl.NET to the appropriate WebSVN page by adding the following additional configuration information to the Subversion source control section:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;webUrlBuilder type=<span class="code-quote">"websvn"</span>&gt;</span>
                <span class="code-tag">&lt;url&gt;</span>http://localhost:7899/websvn/diff.php?repname=MiniACE&amp;amp;path={0}&amp;amp;rev={1}&amp;amp;sc=1<span class="code-tag">&lt;/url&gt;</span>
<span class="code-tag">&lt;/webUrlBuilder&gt;</span></pre>
</div></div>
<p>Change the <b>&lt;url&gt;</b> element to point to the root url for the WebSVN site.  The <b>path</b> and <b>rev</b> parameters will be filled in by CruiseControl.NET when it generates the link to the code file page.</p>

<p>NOTE: The standard url for WebSVN 1.38 contains rep=3 r instead of repname=MiniACE.  Adding a new repository to the SvnParentPath will change the number of the rep parameter, so you may need to make the following change to diff.php to decode the repname parameter:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">$repname = @$_REQUEST[<span class="code-quote">"repname"</span>];

<span class="code-keyword">if</span> (isset($repname))
{
    $rep = $config-&gt;findRepository($repname);
}</pre>
</div></div>
<p>The WebSVN WebUrlBuilder can also be used to connect to a <a href="http://www.viewvc.org/">ViewCV</a> site. Here is an example used by CCNet to link to the file revision pages on <a href="http://svn.sourceforge.net/viewvc/ccnet">SourceForge</a>.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">&lt;webUrlBuilder type=<span class="code-quote">"websvn"</span>&gt;
   &lt;url&gt;http:<span class="code-comment">//svn.sourceforge.net/viewvc/ccnet/{0}?view=markup&amp;pathrev={1}&lt;/url&gt;
</span>&lt;/webUrlBuilder&gt;</pre>
</div></div>

<h3><a name="SubversionSourceControlBlock-SVNoverSSL"></a>SVN over SSL</h3>

<p>When connecting to a Subversion repository via SSL (https), you may be required to accept an issued server certificate. This generally requires responding to a command-line prompt that the certificate should be accepted permanently.  For CruiseControl.NET, all Subversion commands are executed using the <b>&#45;-non-interactive</b> switch, which will cause this prompt to be skipped and the subsequent Subversion command to fail with a message like this:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">svn: PROPFIND request failed on '/svnroot/ccnet'
svn: PROPFIND of '/svnroot/ccnet': Server certificate verification failed: issuer is not trusted (https:<span class="code-comment">//ccnet.svn.sourceforge.net)</span></pre>
</div></div>
<p>As the failure will happen on the first Subversion command to be executed, this failure will not show up as a broken build, but will instead show up in the server log.</p>

<p>One way to resolve this problem is to execute a command against the Subversion repository from the command-line logged in as the user that you are using to run CCNet (certificates are cached by user account, so you must accept the certificate for the appropriate user).  For example, try executing the following command (where <b>trunk_url</b> is the svn url for your repository):</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">svn list [trunk_url]</pre>
</div></div>
<p>When prompted to accept the certificate, type 'P' to permanently accept it.</p>

<p>If you are running <a href="The Server Service Application.html" title="The Server Service Application">CCService</a> under the <b>LocalSystem</b> account, you will need to accept the certificate for this user.  Check out the <a href="The Server Service Application.html" title="The Server Service Application">CCService</a> page for information about how to diagnose problems as the <b>LocalSystem</b> account.</p>

<p>External contributors:</p>
<ul>
	<li>Matt Petteys</li>
</ul>


<h3><a name="SubversionSourceControlBlock-SVNoversvnssh"></a>SVN over svn+ssh</h3>

<p>To connect to Subversion with the svn+ssh protocol, here is an excerpt from the article <a href="http://www.woodwardweb.com/archive/200511.html">HowTo: Configure SVN+SSH with Subclipse on Windows</a> by Martin Woodward.  For more details, see the complete <a href="http://www.woodwardweb.com/archive/200511.html">article</a>.</p>
<div class="panel" style="border-width: 1px;"><div class="panelHeader" style="border-bottom-width: 1px;"><b>HowTo: Configure SVN+SSH with Subclipse on Windows</b></div><div class="panelContent">
<p><b>Solution:</b><br/>
You need to create an environment variable called "SVN_SSH" that points to an executable file that accepts the same command line arguments as ssh on unix. I did this by doing the following:&#45;</p>
<ol>
	<li>Set up ssh keys. Not going to cover that here as you can easily Google for that. You need to end up with your public key on the SVN server and your private key loaded into Paegent locally.</li>
	<li>Download and installed the excellent TortoiseSVN client for Windows.</li>
	<li>Set the following environment variable (by right-clicking on My Computer, Properties, Advanced, Environment Variables, New):&#45;
<pre>Variable name: SVN_SSH
Variable value: C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe
</pre>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The "\ \"(double-back-slash) is very important, otherwise it won't work. Equally, you cannot use the plink.exe that comes with putty as that fires up a command shell window which is really annoying. The TortoisePlink.exe is a windows implementation of plink that doesn't bring up any UI</td></tr></table></div></li>
</ol>
</div></div>

<h3><a name="SubversionSourceControlBlock-KnownIssues"></a>Known Issues</h3>


<h4><a name="SubversionSourceControlBlock-CruiseControl.NETdoesn%27tseemychanges"></a>CruiseControl.NET doesn't see my changes</h4>

<p>The Subversion interface depends on the clocks of the CruiseControl.Net and Subversion servers being set within a small difference.  Due to a long-standing Subversion bug (<a href="http://subversion.tigris.org/issues/show_bug.cgi?id=1642">Bugzilla #1642</a>) that appears unlikely to ever be fixed, CruiseControl.Net must filter the list of modifications returned by Subversion, looking for only those that fall within a specific time range.  When the clocks of the two servers are significantly different, the filter may ignore modifications that should not be ignored.  To prevent this problem, keep the clocks of the two servers set as closely together as possible.</p>

<h4><a name="SubversionSourceControlBlock-DashboardLocalization%28issueswithSVN%29"></a>Dashboard Localization (issues with SVN)</h4>

<p>I've found that svn has a trouble with &#45;-xml parameter. My russian Log Messages were not readable.<br/>
I found a quick solution for it, next items could be customized to any languges. But be sure this is not the panacea.<br/>
So in all .xsl files where <em>comments</em> or <em>filename</em> in Russian local I've added folowing "translation"</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;<span class="code-keyword">xsl:value-of</span> select=<span class="code-quote">"translate(comment,'??????????????????????????????????????????????????????????????????','????????????????????????????????????????????????????????????????')"</span>/&gt;</span></pre>
</div></div>
<p>where <em>comment</em> from /cruisecontrol/modifications/modification, and "??" in second parameter are symbols to delete, all others are mathed with third parameters. As I found xsl could only translate char strings <img class="emoticon" src="images/icons/emoticons/sad.gif" height="20" width="20" align="absmiddle" alt="" border="0"/> , if some one know the way to translate double-char symbols, please note about it.<br/>
In this way you can help your self for modification for any charset.<br/>
I agree with everyone that it is a rude solution. But for my no time to wait untill svn or cc.net will be customized for that feature.</p>

				    
                    			    </td>
		    </tr>
	    </table>
	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td height="12" background="http://confluence.public.thoughtworks.org//images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
			</tr>
		    <tr>
			    <td align="center"><font color="grey">Document generated by Confluence on Sep 29, 2009 20:59</font></td>
		    </tr>
	    </table>
    </body>
</html>